home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / SNDLIST- / INIT.C < prev    next >
Text File  |  1988-11-10  |  1KB  |  54 lines

  1. /*
  2.     Sound lister
  3.     "Init.c"
  4. */
  5.  
  6. #include <MenuMgr.h>
  7. #include "SndList.h"
  8.  
  9. #define sysEnvironsVersion    1
  10. #define TN_WaitNextEvent    0x60
  11. #define TN_Unimplemented    0x9F
  12. #define TN_SndPlay            0x5
  13.  
  14. Boolean TrapAvailable (tNumber, tType)
  15. register short tNumber;
  16. register short tType;
  17. {
  18.     return NGetTrapAddress(tNumber, tType) !=
  19.         GetTrapAddress(TN_Unimplemented);
  20. }
  21.  
  22. void Initialize()
  23. {
  24.     register int i;
  25.     pascal void Crash();
  26.  
  27.     for (i = 0; i < 5; i++)
  28.         MoreMasters();
  29.     InitGraf(&thePort);
  30.     InitFonts();
  31.     InitWindows();
  32.     InitMenus();
  33.     TEInit();
  34.     InitDialogs(Crash);
  35.     InitCursor();
  36.  
  37.     Bounds = screenBits.bounds;
  38.     InsetRect(&Bounds, 4, 4);
  39.     SysEnvirons(sysEnvironsVersion, &gMac);
  40.     if (gMac.machineType < 0 || !TrapAvailable(TN_SndPlay, ToolTrap)) {
  41.         Bounds.top += 20;
  42.         Message(mOld, 0);
  43.         ExitToShell();
  44.     }
  45.     Bounds.top += MBarHeight;
  46.     gHasWaitNextEvent = TrapAvailable(TN_WaitNextEvent, ToolTrap);
  47.     SetMenuBar(GetNewMBar(rMenuBar));
  48.     AddResMenu(GetMHandle(mApple), 'DRVR');
  49.     DrawMenuBar();
  50.     gInBackground = FALSE;
  51.     gNumDocuments = 0;
  52.     Play(HiSnd);
  53. }
  54.